using System.Xml;
using System.IO;
using System.Collections.Generic;
using System;

namespace ProcedureAuto
{
    public class Config
    {
        public Config() 
        {
            
        }

        public IDictionary<String, String> LoadConfig(string configFileName)
        {
            try
            {
                if (File.Exists(configFileName))
                {
                    IDictionary<String, String> map = new Dictionary<String, String>();
                    XmlDocument doc = new XmlDocument();
                    doc.Load(configFileName);
                    foreach (XmlNode node in doc["configuration"])
                    {
                        map.Add(node.Attributes["name"].Value.ToString(), node["value"].InnerText);
                    }
                    return map;
                }
                else
                {
                    return null;
                }
            }
            catch
            {
                return null;
            }
        }
    }
}
